<script type="text/javascript" src="js/Calendar.js"></script>
<link rel="stylesheet" href="css/getbill.css"/>
<link rel="stylesheet" href="css/page.css"/>
<div class="clay">
	<h3 class="mc_title">
		<span class="mctit_1"><span class="mctit_2"><?=$h3Title?></span></span>
	</h3>
	<ul class="navi">
		<li><a href="getbill.html">已出账单</a></li>
		<li><a href="settle_config.html?about=<?=$about?>">结算周期配置</a></li>
		<?php if($_SESSION['memberID']==94):?>
        <li><a  class="settle current" href="javascript:;">现场支付账单</a></li>
        <?php endif;?>
	</ul>
	<div class="settleContain">
		<div class="contain">
			<form action="" class="search">
                <input name="pay" value="<?=$_GET['pay']?>" type="hidden"/>
				<div class="box">
					<span>
						<input type="submit" class="sub" value="查 询"/>
						<label>出账日期:</label>
						<input type="text" name="btime" class="time" value="<?=$_REQUEST['btime']?>" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)"/>
						<label>至</label>
						<input type="text" name="etime" class="time" value="<?=$_REQUEST['etime']?>" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)"/>
					</span>
                    <span class="status">
						<input type="radio" name="btype" <?=!$_GET['btype'] ? "checked" : "";?> value="0"/> 现场支付
                        <?if(!$access['yd'] || ($_GET['about']!='pay')):?>
						<input type="radio" name="btype" <?=isset($_GET['btype']) && $_GET['btype']==1 ? "checked" : "";?> value="1"/> 在线支付
                         <?endif;?>
					</span>
					<span class="status">
						<label>结算状态:</label>
						<input type="checkbox" name="status[]" <?if(in_array(0,$status)) echo "checked";?> value="0"/> 未结算
						<input type="checkbox" name="status[]" <?if(in_array(1,$status)) echo "checked";?> value="1"/> 结算中
						<input type="checkbox" name="status[]" <?if(in_array(2,$status)) echo "checked";?> value="2"/> 已结算
					</span>

				</div>
			</form>
		</div>
		<?if(count($r)>0):?>
		<div class="content">
			<table>
				<tr>
					<?if($about=="get"):?>
					<th class="tl">分销商</th>
					<?else:?>
					<th class="tl">供应商</th>
					<?endif;?>
					<th>出账日期</th>
					<th>账单期间</th>
					<th>账单明细</th>
					<th>订单数</th>
					<th>票数</th>
					<th>总金额(元)</th>
					<th>结算状态</th>
					<th>操作</th>
				</tr>
                <?php if(count($r)):?>
                    <?php foreach($r as $row):?>
                    <tr>
                        <?if($about=="get"):?>
                        <td class="tl"><?=$dnames[$row['fid']]?></td>
                        <?else:?>
                        <td class="tl"><?=$dnames[$row['aid']]?></td>
                        <?endif;?>
                        <td><?=date("Ymd",strtotime($row['etime']))?></td>
                        <td>
                            <span title="<?=$row['btime']?>"><?=substr($row['btime'],0,10)?></span>
                            至
                            <span title="<?=$row['etime']?>"><?=substr($row['etime'],0,10)?></span>
                        </td>
                        <td>
                            <a class="fdetail" target="_blank" href="bill_count.html?id=<?=$row['id']?>&pay=<?=$btype?>&flag=1">汇总</a>
                            |
                            <a class="fdetail" target="_blank" href="bill_detail.html?id=<?=$row['id']?>&pay=<?=$btype?>&flag=1">明细</a>
                        </td>
                        <td><?=$row['orders']?></td>
                        <td><?=$row['tnums']?></td>
                        <td><?=$row['money']/100?></td>
                        <td><?=$statusT[$row['status']]?></td>
                        <td>
                            <a  class="billalter" href="call/handle.php?from=bill_alter&act=complete&id=<?=$row['id']?>">完成</a>
                        </td>
                    </tr>
                    <?endforeach;?>
                <?php else:?>
                <tr>
                    <td colspan="9">不存在账单</td>
                </tr>
                <?php endif;?>
			</table>
		</div>
		<?endif;?>
	</div>
	<?php page($count,$currentPage,$pageSize);?>
</div>
<script type="text/javascript" src="js/fsettle.js"></script>